package com.thirdgroup.service.impl;

import com.thirdgroup.dao.IndustryDao;
import com.thirdgroup.dao.impl.IndustryDaoImpl;
import com.thirdgroup.pojo.entity.BusinessCustomerIndustry;
import com.thirdgroup.service.IndustryService;
import com.thirdgroup.utils.respond.R;

import java.util.ArrayList;
import java.util.List;

public class IndustryServiceImpl implements IndustryService {
    private IndustryDao industryDao=new IndustryDaoImpl();
    @Override
    public R selectName() {
        List<String> names=new ArrayList<>();
        for (BusinessCustomerIndustry businessCustomerIndustry : industryDao.selectName()) {
            names.add(businessCustomerIndustry.getIndustryname());
        }
        System.out.println("打印行业表：");
        for (String name : names) {
            System.out.println(name);
        }
        if(names!=null&&!"".equals(names)){
            return R.ok(names);
        }
        System.out.println("系统繁忙，请稍后再试~");
        return R.error(500,"系统繁忙，请稍后再试~");
    }
}
